home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / DAC_3D.DMO < prev    next >
Text File  |  1996-07-04  |  5KB  |  89 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   DAC_3D  .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. $INCLUDE "DAS-NB01.INC"
  22. SCREEN 12
  23. COLOR 15, 0
  24. CLS
  25. ? "┌────────────────────────────────────────────────────────────────────────────
  26. ? "│ DACcolorSet   ( Colour$, DacNo?, R?, G?, B? )
  27. ? "│ DACcolorSet3D ( Colour$, DACno? )
  28. ? "│ DACcolorDATA  ( Colour$, Red?, Green?, Blue? )
  29. ? "├────────────────────────────────────────────────────────────────────────────
  30. ? "│ By setting the DAC and PALETTE you can get good 3D out of the VGA screen.
  31. ? "│ This really isn't hard but it helps to "move things around" a bit to make.
  32. ? "│ the color numbers more logical. DACcolorDATA is a monster routine that is
  33. ? "│ only RGB data. I NEVER load it into a finished program as I pull out the
  34. ? "│ numbers, make them into a string then call DACwriteSTR as it is many Kbytes
  35. ? "│ cheaper! As DACcolorSet & DACcolorSet3D both call and use DACcolorDATA they
  36. ? "│ too are just programming tools to help get things right. They all work and
  37. ? "│ work well, it is just the size that bothers me! Anyhow, have a close look
  38. ? "│ at how the DAC and PALETTE are arranged in the code. It will tell you a
  39. ? "│ whole lot about how easy things can be when you're in control!
  40. ? "├────────────────────────────────────────────────────────────────────────────
  41. ? "│ fLoadDAScolor$ ()  loads Red, Green, Blue, Yellow, Grey have a look!
  42. ? "└────────────────────────────────────────────────────────────────────────────
  43.                                        '┌────────────────────────────────────
  44. FOR X% = 0 TO 15                       '│ set PB's pallet numbers to 1 -> 15
  45.   PALETTE X%, X%                       '│ so it is easier to remember which
  46. NEXT                                   '│ DAC's are setting
  47.                                        '│
  48. DACcolorDATA "WHITE", R?, G?, B?       '│ get RGB vals from data
  49. DACset 0, R?, G?, B?                   '│ 0 = Bright White
  50. DACcolorSet3D "DASRED"  , 1            '│ 1 = Red    6 = LtRed   11 = DkRed
  51. DACcolorSet3D "DASGREEN", 2            '│ 2 = Green  7 = LtGreen 12 = DkGreen
  52. DACcolorSet3D "DASBLUE" , 3            '│ 3 = Blue   8 = LtBlue  13 = DkBlue
  53. DACcolorSet3D "DASGOLD" , 4            '│ 4 = Gold   9 = LtGold  14 = DkGold
  54. DACcolorSet3D "DASGREY" , 5            '│ 5 = Grey  10 = LtGrey  15 = DkGrey
  55.                                        '│
  56. REM fLoadDAScolor$                     '│ this does the same as the 12 lines
  57.                                        '│ above  UNREM it and have a look!
  58. X1% = 50  : X2% = 145                  '│ left most column
  59. Y1% = 350 : Y2% = 445                  '│
  60. FOR Colour? = 1 TO 5                   '│
  61.   TriDBox X1%, Y1%, X2%, Y2%, Colour?  '│ draw 5 boxes
  62.   INCR X1%, 100                        '│
  63.   INCR X2%, 100                        '│
  64. NEXT                                   '│
  65.                                        '│
  66. fAnyKey                                '│
  67. PALETTE : SCREEN 0 : CLS : END         '│ "Put the toys back in the box, Jr."
  68. ' ──────────────────────────────────────┴────────────────────────────────────
  69. ' ═══════════════════════════════════════════════════════════════════════════
  70.  
  71. SUB TriDBox ( BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%, BYVAL Na? ) LOCAL PUBLIC
  72.   LOCAL La?, Da?
  73.  
  74.   La? = ( Na? +  5 )
  75.   Da? = ( Na? + 10 )
  76.   LINE ( X1%, Y1% ) - ( X2%, Y2% ), 15, B    ' a black border
  77.   FOR Z% = 1 TO 4                            '
  78.     INCR X1%, 1  :  INCR Y1%, 1              '
  79.     DECR X2%, 1  :  DECR Y2%, 1              '
  80.     LINE ( X1%, Y1% ) - ( X2%, Y1% ), La?    ' top
  81.     LINE ( X1%, Y1% ) - ( X1%, Y2% ), La?    ' left  side
  82.     LINE ( X2%, Y1% ) - ( X2%, Y2% ), Da?    ' right side
  83.     LINE ( X1%, Y2% ) - ( X2%, Y2% ), Da?    ' bottom
  84.     IF Z% = 3 THEN SWAP La?, Da?
  85.   NEXT
  86.   LINE ( X1%+1, Y1%+1 ) - ( X2%-1, Y2%-1 ), Na?, BF
  87.  
  88. END SUB
  89.